<template>
  <!-- 使用后台通用布局组件包裹内容 -->
  <AdminLayout>
    <!-- 后台首页主内容 -->
    <h1>后台管理系统</h1>
    <el-card style="margin-bottom: 20px;">
      <h2>欢迎使用企业官网后台管理</h2>
      <p>请通过左侧导航进入各模块进行内容管理。</p>
    </el-card>
    <el-row :gutter="20">
      <el-col :span="6">
        <el-card>
          <h3>产品管理</h3>
          <el-button type="primary" @click="goTo('/admin/products')">进入</el-button>
        </el-card>
      </el-col>
      <el-col :span="6">
        <el-card>
          <h3>新闻管理</h3>
          <el-button type="primary" @click="goTo('/admin/news')">进入</el-button>
        </el-card>
      </el-col>
      <el-col :span="6">
        <el-card>
          <h3>案例管理</h3>
          <el-button type="primary" @click="goTo('/admin/cases')">进入</el-button>
        </el-card>
      </el-col>
      <el-col :span="6">
        <el-card>
          <h3>合作伙伴管理</h3>
          <el-button type="primary" @click="goTo('/admin/partners')">进入</el-button>
        </el-card>
      </el-col>
    </el-row>
    <el-row :gutter="20" style="margin-top: 20px;">
      <el-col :span="6">
        <el-card>
          <h3>表单管理</h3>
          <el-button type="primary" @click="goTo('/admin/contact')">进入</el-button>
        </el-card>
      </el-col>
      <!-- 可扩展更多后台模块入口 -->
    </el-row>
  </AdminLayout>
</template>

<script setup>
// 引入 AdminLayout 组件
import AdminLayout from '~/components/AdminLayout.vue'
// 引入 useRouter 用于页面跳转
import { useRouter } from 'vue-router'
const router = useRouter()
// 跳转函数
function goTo(path) {
  router.push(path)
}
</script>

<style scoped>
h1 {
  margin-bottom: 30px;
}
.el-card {
  min-height: 100px;
}
</style> 